#include <QtGui/QApplication>
#include <QtGui/QPushButton>
#include <QtGui/QTableView>

#include <Qt-utils/table-models.h>
#include "DiamondData.h"

int main(int argc, char** argv)
{
  try {
    QApplication app(argc, argv);

    DiamondDataRow::register_dyntype();
    ifstream in("diamonds-dataset/4c.dat");
    //ifstream in("./4c.dat");
    vector<DiamondDataRow> drs;
    load_DiamonDataRow_file(in, &drs);
    cerr << "loaded " << drs.size() << " rows" << endl;

    STLVectorAdapter<DiamondDataRow> drs_a(&drs);
    VectorModel<DiamondDataRow> m(&drs_a);
    QTableView tv;
    tv.setModel(&m);
    tv.show();
    return app.exec();

  } catch (Error& e) {
    cerr << "Error caught: " << e.msg() << endl;
  }
}
